package com.taotao.sys.ftl;


import com.taotao.common.auth.AuthRequired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 通用匹配ftl页面的
 */
@AuthRequired
@Controller
@RequestMapping("/pages")
public class PageController {


    @GetMapping(value = "/{path1}")
    public ModelAndView page1(@PathVariable("path1") String path1) {
        return new ModelAndView("pages/" + path1);
    }

    @GetMapping(value = "/{path1}/{path2}")
    public ModelAndView page2(@PathVariable("path1") String path1, @PathVariable("path2") String path2) {
        return new ModelAndView("pages/" + path1 + "/" + path2);
    }


    @GetMapping(value = "/{path1}/{path2}/{path3}")
    public ModelAndView page3(@PathVariable("path1") String path1, @PathVariable("path2") String path2, @PathVariable("path3") String path3) {
        return new ModelAndView("pages/" + path1 + "/" + path2 + "/" + path3);
    }

}
